<%--
  Created by IntelliJ IDEA.
  User: yiyi
  Date: 2018/8/13
  Time: 17:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
</head>

<body>
   <h1>商务会员管理系统</h1>
   <form id="denglu">
       用户名：<input name="name"><br>
       密码：<input type="password" name="password"><br>
       <a href="javascript:;" onclick="login()" >登录</a>
   </form>
   <script>
       function login() {
           var data= $("#denglu").serialize();
           $.ajax({
               url:"${pageContext.request.contextPath}/Login",
               data:data,
               type:"POST",
               datatype:"json",
               success:function (msg) {
                   if (msg.code==404){
                       alert(msg.msg)
                   }else if (msg.code==300){
                       alert(msg.msg)
                   }else if (msg.code==500){
                       alert(msg.msg)
                   }else {
                       location.href="${pageContext.request.contextPath}/Usertype";
                   }
               },
               error:function (msg) {
                 alert("服务器出错")
               }
           });
       }
   </script>
</body>
</html>
